use day19::rule::*;
use day19::rating::PartKind;

#[test]
fn test_str_to_rule() {
    let rule: Rule = "a<2006:qkq".into();
    assert_eq!(
        rule,
        Rule::ConditionJump(ConditionJumpRule::new(
            PartKind::Aerodynamic, 
            RuleOpertion::Less, 
            2006, 
            "qkq".to_string()
        ))
    );

    let rule: Rule = "m>2090:A".into();
    assert_eq!(
        rule,
        Rule::ConditionAccept(ConditionAcceptRule::new(
            PartKind::Musical, 
            RuleOpertion::Great, 
            2090, 
            true,
        ))
    );

    let rule: Rule = "rfg".into();
    assert_eq!(
        rule,
        Rule::Jump(JumpRule::new("rfg".to_string()))
    );

    let rule: Rule = "A".into();
    assert_eq!(
        rule,
        Rule::Accept,
    );

    let rule: Rule = "R".into();
    assert_eq!(
        rule,
        Rule::Reject,
    );

}